<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<title>Pillefyr status</title>
	<link href="./examples.css" rel="stylesheet" type="text/css">
	<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="flot/excanvas.min.js"></script><![endif]-->
	<script language="javascript" type="text/javascript" src="flot/jquery.js"></script>
	<script language="javascript" type="text/javascript" src="flot/jquery.flot.js"></script>
	<script language="javascript" type="text/javascript" src="flot/jquery.flot.time.js"></script>
	<!-- <script language="javascript" type="text/javascript" src="flot/jquery.flot.navigate.js"></script> -->
	<script type="text/javascript">

	$(function() {
		function update(){
				function onDataReceived(series)
				{
					var oldTable = document.getElementById('data_table'), newTable = oldTable.cloneNode();
						
					for(var row = 0; row < series.data.length; row++)
					{
						var tr = document.createElement('tr');
						for(var col = 0; col < series.data[row].length; col++)
						{
							var td;
							if (row != 0)
								td = document.createElement('td');
							else
								td = document.createElement('th');
							td.appendChild(document.createTextNode(series.data[row][col]));
							tr.appendChild(td);
						}
						newTable.appendChild(tr);
					}					
					$.plot("#placeholder", series.graph, series.options);
					$.plot("#monthly_placeholder", series.monthly, series.options2);
					oldTable.parentNode.replaceChild(newTable, oldTable);
				}

				$.ajax({
					url: "tmp/data.json",
					type: "GET",
					dataType: "json",
					success: onDataReceived
				});
		};
		update(); // Force immediate update
		setInterval(update, 60000); // Update each minute from now on.
	});

	</script>
</head>
<body>
	<div id="header">
		<h2>Scotte 16kW. Driftstatus :</h2>
	</div>

	
	<table>
		<tr><td>
			<table id="data_table" class="data_table"><tr><th width="200">Parameter:</th><th width="200">Data:</th></tr></table>
		</td><td>
			<div class="plot-container">
				<div id="placeholder" class="plot-placeholder"></div>
			</div>
			<div class="plot-container">
				<div id="monthly_placeholder" class="plot-placeholder"></div>
			</div>
		</td></tr>
	</table>		
	
	

	<div id="footer">
		Plotting library: <a href="http://www.flotcharts.org/">Flot</a> by IOLA and Ole Laursen<br>
		Hardware: Beaglebone by <a href="http://beagleboard.org/">Beagleboard</a><br>
		Software: <b>Jesper Pedersen</b>
	</div>

</body>
</html>
